//
//  SignatureTableViewCell.m
//  Today
//
//  Created by dllo on 15/5/22.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "SignatureTableViewCell.h"

@implementation SignatureTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createMycell];
    }
    return self;
}
//创建自己的cell视图
-(void)createMycell
{
    
    self.TitleLable = [[UILabel alloc]init];
    [self.contentView addSubview:self.TitleLable];
    [self.TitleLable release];
    
    self.PicImage = [[UIImageView alloc]init];
    [self.contentView addSubview:self.PicImage];
    [self.PicImage release];
    
    self.TimeStrLable = [[UILabel alloc]init];
    [self.contentView addSubview:self.TimeStrLable];
    [self.TimeStrLable release];
    
    self.ShareICon = [[UIImageView alloc]init];
    [self.contentView addSubview:self.ShareICon];
    [self.ShareICon release];
    
    self.SharePressBut = [[UIButton alloc]init];
    [self.contentView addSubview:self.SharePressBut];
    [self.SharePressBut release];
    
    self.CollectinoIcon = [[UIImageView alloc]init];
    [self.contentView addSubview:self.CollectinoIcon];
    [self.CollectinoIcon release];
    
    self.CollectionPressbut = [[UIButton alloc]init];
    [self.contentView addSubview:self.CollectionPressbut];
    [self.CollectionPressbut release];
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    self.TitleLable.frame = CGRectMake(0, 50, 375, 50);
    self.TitleLable.backgroundColor = [UIColor colorWithRed:0.500 green:0.451 blue:0.254 alpha:1.000];
    self.PicImage.frame = CGRectMake(5, 110, 370, 150);
    self.TimeStrLable.frame = CGRectMake(10, 270, 100, 20);
    self.ShareICon.frame = CGRectMake(160, 270, 30, 20);
    self.SharePressBut.frame = CGRectMake(195, 270, 80, 30);
    [self.SharePressBut setTitle:@"分享" forState:UIControlStateNormal];
    [self.SharePressBut setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.SharePressBut addTarget:self action:@selector(ShareContent:) forControlEvents:UIControlEventTouchUpInside];
    self.CollectinoIcon.frame = CGRectMake(285, 270, 30, 20);
    self.CollectionPressbut.frame = CGRectMake(325, 270, 85, 20);
    [self.CollectionPressbut setTitle:@"收藏" forState:UIControlStateNormal];
    [self.CollectionPressbut setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.CollectionPressbut addTarget:self action:@selector(CollectionContent:) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    
    
    
}
-(void)ShareContent:(UIButton *)sharebutton
{
    
    
}
-(void)CollectionContent:(UIButton *)collectionbutton
{
    
    
}
//重写model方法
-(void)setModel:(SignatureModel *)Model
{
    self.TitleLable.text = self.Model.title;
    NSURL *url = [NSURL URLWithString:Model.pic];
    NSData *data = [NSData dataWithContentsOfURL:url];
    UIImage *image = [UIImage imageWithData:data];
    self.PicImage.image = image;
    self.TimeStrLable.text = Model.timeStr;
    self.ShareICon.image = [UIImage imageNamed:@"star_faved"];
    self.CollectinoIcon.image = [UIImage imageNamed:@"ad.png"];
    
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
